package com.youlu.campus.common.exception;

/**
 * Created by zhuhuaiqi
 */
public class ArgumentException extends IllegalArgumentException {

    protected ApiErrorCode errorCode;

    public ArgumentException(ApiErrorCode errorCode) {
        super(formatMsg(errorCode));
        this.errorCode = errorCode;
    }

    public ApiErrorCode getErrorCode() {
        return this.errorCode;
    }

    public final static String formatMsg(ApiErrorCode errorCode) {
        return String.format("%s:%s", errorCode.getCode(), errorCode.getMessage());
    }
}
